# This code is part of the MWP System
# Copyright (c) 2012 Benjamin Lubin (blubin@bu.com) 
# Published under and subject to the GPLv2 license available at http://www.gnu.org/licenses/gpl-2.0.html

'''
Created on Dec 18, 2012
@author: blubin
'''
from random import randrange
from frontend.roleApplication import RoleApplication;
from frontend.form import Type;

class QAApplication(RoleApplication):
    """ The QA Interface """

    def __init__(self):
        super(QAApplication, self).__init__("storagegalore", "QA");
        qualityNumber = randrange(1,10)
        indexQuality = randrange(1,10)
        self.register_transition_step("CheckQuality", self.check_quality_form_creator, name_fields=["sequence", "FirstName", "LastName", 'DocumentNumber', qualityNumber]);
        self.register_transition_step("CompareIndexes", self.compare_indexes_form_creator, name_fields=["sequence", "FirstName", "LastName", "DocumentNumber", indexQuality]);
        self.register_transition_step("ReconcileIndexes", self.reconcile_indexes_form_creator, name_fields=["sequence", "FirstName", "LastName", "DocumentNumber", indexQuality]);

    def check_quality_form_creator(self, stepname, form):
        form.add_task_label(fields=["FirstName", "LastName", "DocumentNumber"]);
        #form.add_field(Type.LONGSTRING, "History");
        #form.add_field(Type.SHORTSTRING, "Diagnosis");

    def compare_indexes_form_creator(self, stepname, form):
        form.add_task_label(fields=["FirstName", "LastName", "DocumentNumber"]);
    
    def reconcile_indexes_form_creator(self, stepname, form):
        form.add_task_label(fields=["FirstName", "LastName", "DocumentNumber"]);

if __name__ == '__main__':
    app = QAApplication();
    app.MainLoop();